procedure dectodrob(var a,b:int64; s:string);
var i,x,y:longint; z,p,n,m,q,t:int64;
begin
x:=pos('.',s);
a:=0;
p:=0;
q:=1;
b:=1;
m:=0;
n:=1;
t:=0;
if x<=0 then x:=length(s)+1;
for i:=1 to x-1 do a:=a*10+ord(s[i])-48;
y:=pos('(',s);
if y<=0 then y:=length(s)+1;
for i:=x+1 to y-1 do begin
  p:=p*10+(ord(s[i])-ord('0'));
  q:=q*10;
end;
if y<>length(s)+1 then begin
  for i:=y+1 to length(s)-1 do begin
    t:=t*10+ord(s[i])-48;
    n:=n*10;
  end;
  n:=q*(n-1);
  if n<q then z:=gcd(n,q) else z:=gcd(q,n);
  n:=n div z;
  q:=q div z;
  p:=p*n+t*q;
  q:=q*n*z;
end;
a:=a*q+p;
b:=q;
if a>b then z:=gcd(b,a) else z:=gcd(a,b);
a:=a div z;
b:=b div z;
end;